import { useState } from "react"
import FormInput from "./fromInput"
import Tolist from './Tolist'
import '../../../list/list.scss'
import ContextTodo,{ state } from "../../../../store/todolist"
const ConTodoList=()=>{
    const [todo,setTodoList]=useState({
        list:[
            {
                date:'日期',
                title:'标题',
                priority:'优先级'
            }
        ]
    })
    let updatetolist=(e)=>{
        console.log(e)
        let nlist = todo.list
        nlist.push(e)
        setTodoList({
            ...todo,
            list:nlist
        })
    }
    return(<>
       <div className="listbox">
        <ContextTodo.Provider value={{...todo,updatetolist}}>
            <FormInput/>
            <Tolist/>
        </ContextTodo.Provider>
       </div>
    </>)
}
export default ConTodoList